package main

import "fmt"

func main() {
	arr := [5]int{321, 1322, 323, 314, 347}
	res := bubbleSort(&arr)
	fmt.Println(res)
}

//冒泡排序
func bubbleSort(arr *[5]int) [5]int {
	for i := 0; i < len(arr)-1; i++ {
		for j := 0; j < len(arr)-1-i; j++ {
			if (*arr)[j] > (*arr)[j+1] {
				temp := (*arr)[j]
				(*arr)[j] = (*arr)[j+1]
				(*arr)[j+1] = temp
			}
		}

	}
	return *arr
}
